import request from '@/axios'

//分页查询服务器配置
export const pageApi = (data) => {
  return request.post({ url: '/dbms-server/base/servers/page', data })
}

//删除服务器配置
export const delApi = (ip: string) => {
  return request.delete({ url: '/dbms-server/base/servers/delete', params: { ip } })
}

//新增服务器配置
export const addApi = (data) => {
  return request.post({ url: '/dbms-server/base/servers/add', data })
}

//修改服务器配置
export const updateApi = (data) => {
  return request.put({ url: '/dbms-server/base/servers/update', data })
}

//获取服务器配置
export const getApi = (params) => {
  return request.get({ url: '/dbms-server/base/servers/get', params })
}

//获取所有正常的服务器
export const listApi = () => {
  return request.get({ url: '/dbms-server/base/servers/list' })
}

//获取所有服务器
export const listAllApi = () => {
  return request.get({ url: '/dbms-server/base/servers/listAll' })
}

//获取服务器健康状态
export const healthApi = (ip: string) => {
  return request.get({ url: '/dbms-server/base/servers/health', params: { ip } })
}

//重启服务器
export const restartServerApi = (ip: string) => {
  return request.post({ url: '/dbms-server/base/servers/restart', data: { ip } })
}
